const mongoose = require('mongoose');
const moment = require('moment-timezone');

const studentSchema = new mongoose.Schema({
    id: { type: String, required: true, unique: true },
    account: { type: String, required: true },
    name: { type: String, required: true },
    password: { type: String, required: true },
    college: { type: String, required: true },
    major: { type: String, required: true },
    className: { type: String, required: true },
    gender: { type: Number, required: true }, // 1: 男, 2: 女
    phone: { type: String, required: false },
    idCard: { type: String, required: false },
    createTime: { type: Date, default: () => moment().tz('Asia/Shanghai').toDate() },
    updateTime: { type: Date, default: () => moment().tz('Asia/Shanghai').toDate() },
});

module.exports = mongoose.model('Student', studentSchema);